package com.example.droideep.fragment.tabs;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * @author bri
 * @date 15-6-10.
 */
public class TabsAdapter extends PagerAdapter {

    private String[] mTitles;

    public TabsAdapter(String[] mTitles) {
        this.mTitles = mTitles;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }

    @Override
    public int getCount() {
        return mTitles.length;
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        TextView tab = new TextView(container.getContext());
        tab.setText("tab" + position);
        container.addView(tab);
        return tab;
    }

}
